package com.hbnu.tangyalu;

import java.io.*;

public class ReadDemo {
    public static void main(String[] args) {
        String path="D:"+File.separator+"program"+File.separator+"tttt.txt";
        File file=new File(path);
        Reader reader=null;
        try {
            reader=new FileReader(file);
            char[] buffer=new char[1024];
//            int len=reader.read(buffer);
//            System.out.println(new String(buffer,0,len));

            int len=0;
            int temp;
            while ((temp= reader.read())!=-1){
                buffer[len++]=(char) temp;
            }

        }
        catch (Exception e){
            e.printStackTrace();
        }
        finally {
            try {
                if (reader!=null) {
                    reader.close();
                }
            }
            catch (IOException e){
                e.printStackTrace();
            }
        }
    }
}
